package com.pb.news.entity; /**
 * ${NAME}--BDQN_WEB_NEWS
 *
 * @author: Jovi
 * @createTime: 2018-04-11 16:00
 **/

import com.pb.news.constants.Constants;
import lombok.Data;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;

@Data
@WebListener()
public class User implements HttpSessionBindingListener {

    // Public constructor is required by servlet spec
    public User() {
    }

    int id;
    String userName;
    String password;
    String email;


    @Override
    public void valueBound(HttpSessionBindingEvent httpSessionBindingEvent) {
        Constants.ONLINE_USER_COUNT++;
    }

    @Override
    public void valueUnbound(HttpSessionBindingEvent httpSessionBindingEvent) {
        Constants.ONLINE_USER_COUNT--;
    }
}
